package com.spsoft.dmzeinvoice.controller;

import com.spsoft.core.annotation.AnonymousAccess;
import com.spsoft.core.model.Result;
import com.spsoft.dmzeinvoice.common.annotation.DmzLog;
import com.spsoft.dmzeinvoice.service.VmsRedInvoiceService;
import com.spsoft.core.model.leqidmz.param.ApplyRedConfirmDetailParam;
import com.spsoft.core.model.leqidmz.param.ConfirmRedConfirmParam;
import com.spsoft.core.model.leqidmz.param.QueryRedConfirmDetailParam;
import com.spsoft.core.model.leqidmz.param.QueryRedConfirmListParam;
import com.spsoft.core.model.leqidmz.response.ApplyRedConfirmVO;
import com.spsoft.core.model.leqidmz.response.ConfirmRedConfirmVO;
import com.spsoft.core.model.leqidmz.response.QueryRedConfirmDetailVO;
import com.spsoft.core.model.leqidmz.response.QueryRedConfirmListVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = {"红字票相关模块"})
@RequestMapping("/redInvoice")
@RestController
@RequiredArgsConstructor
public class VmsRedInvoiceController {

    private final VmsRedInvoiceService vmsRedInvoiceService;

    @ApiOperation("数电红字确认单申请")
    @AnonymousAccess(value = "/applyRedConfirm", method = RequestMethod.POST, permissionCode = "")
    @DmzLog(leqiName = "数电红字确认单申请")
    public Result<ApplyRedConfirmVO> applyRedConfirm(@RequestBody @Validated ApplyRedConfirmDetailParam param) {
        return vmsRedInvoiceService.applyRedConfirm(param);
    }

    @ApiOperation("数电红字确认单确认")
    @AnonymousAccess(value = "/confirmRedConfirm", method = RequestMethod.POST, permissionCode = "")
    @DmzLog(leqiName = "数电红字确认单确认")
    public Result<ConfirmRedConfirmVO> confirmRedConfirm(@RequestBody @Validated ConfirmRedConfirmParam param) {
        return vmsRedInvoiceService.confirmRedConfirm(param);
    }

    @ApiOperation("查询数电红字确认单明细")
    @AnonymousAccess(value = "/queryRedConfirmDetail", method = RequestMethod.POST, permissionCode = "")
    @DmzLog(leqiName = "查询数电红字确认单明细")
    public Result<QueryRedConfirmDetailVO> queryRedConfirmDetail(@RequestBody @Validated QueryRedConfirmDetailParam param) {
        return vmsRedInvoiceService.queryRedConfirmDetail(param);
    }

    @ApiOperation("查询数电红字确认单列表")
    @AnonymousAccess(value = "/queryRedConfirmList", method = RequestMethod.POST, permissionCode = "")
    @DmzLog(leqiName = "查询数电红字确认单列表")
    public Result<QueryRedConfirmListVO>  queryRedConfirmList(@RequestBody @Validated QueryRedConfirmListParam param){
        return vmsRedInvoiceService.queryRedConfirmList(param);
    }

}
